package spring.DI.methodDI;

import org.springframework.beans.factory.annotation.Autowired;
import org.springframework.beans.factory.annotation.Lookup;
import org.springframework.stereotype.Component;

/**
 * 使用 @Lookup 注解实现（https://cloud.tencent.com/developer/article/1554037）
 *  默认情况下 @Lookup 根据返回类型查找 原型bean
 *
 * @author ME
 * @date 2019/2/26 17:58
 */
@Component
public abstract class Animal2 {

    @Autowired
    private Dog dog;

    public Dog getDog() {
        return dog;
    }

    // setter注入
    public void setDog(Dog dog) {
        this.dog = dog;
    }

    @Lookup
    public abstract Dog createDog();

}
